package com.kawaiior.asoulworld.capability;

import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.INBTSerializable;

public class AvaPower implements INBTSerializable<NBTTagCompound> {
    private int cool_down;
    private float power;

    public AvaPower() {
        this.cool_down = 0;
        this.power = 0;
    }

    public void coolDown() {
        if (this.cool_down > 0){
            cool_down--;
        }
    }

    public void setHot() {
        this.cool_down = 60;
    }

    public Boolean isHot(){
        return this.cool_down > 0;
    }

    public float getPower() {
        return power;
    }

    public void setPower(float power) {
        this.power = power;
    }

    public void addPower(float power){
        this.power += power;
    }

    public int getCool_down(){
        return this.cool_down;
    }

    @Override
    public NBTTagCompound serializeNBT() {
        NBTTagCompound nbt = new NBTTagCompound();

        nbt.setFloat("AvaPower", this.power);
        nbt.setInteger("AvaCoolDown", this.cool_down);
        return nbt;
    }

    @Override
    public void deserializeNBT(NBTTagCompound nbt) {
        this.power = nbt.getInteger("AvaPower");
        this.cool_down = nbt.getInteger("AvaCoolDown");
    }
}
